package org.msfj.admin.model;

import org.msfj.common.base.BaseModel;

import javax.persistence.Column;
import javax.persistence.Table;
import java.io.Serializable;

@Table(name = "admin_dict")
public class Dict extends BaseModel implements Serializable {
    /**
     * 数据字典索引编号
     */
    @Column(name = "index_id")
    private String indexId;

    /**
     * 英文代码
     */
    @Column(name = "code_")
    private String code;

    /**
     * 文字说明
     */
    @Column(name = "code_text")
    private String codeText;

    /**
     * 排序号
     */
    @Column(name = "sort_no")
    private Integer sortNo;

    /**
     * 是否可编辑
     */
    @Column(name = "editable_")
    private Integer editable;



    /**
     * 获取数据字典索引编号
     *
     * @return index_id - 数据字典索引编号
     */
    public String getIndexId() {
        return indexId;
    }

    /**
     * 设置数据字典索引编号
     *
     * @param indexId 数据字典索引编号
     */
    public void setIndexId(String indexId) {
        this.indexId = indexId;
    }

    /**
     * 获取英文代码
     *
     * @return code_ - 英文代码
     */
    public String getCode() {
        return code;
    }

    /**
     * 设置英文代码
     *
     * @param code 英文代码
     */
    public void setCode(String code) {
        this.code = code == null ? null : code.trim();
    }

    /**
     * 获取文字说明
     *
     * @return code_text - 文字说明
     */
    public String getCodeText() {
        return codeText;
    }

    /**
     * 设置文字说明
     *
     * @param codeText 文字说明
     */
    public void setCodeText(String codeText) {
        this.codeText = codeText == null ? null : codeText.trim();
    }

    /**
     * 获取排序号
     *
     * @return sort_no - 排序号
     */
    public Integer getSortNo() {
        return sortNo;
    }

    /**
     * 设置排序号
     *
     * @param sortNo 排序号
     */
    public void setSortNo(Integer sortNo) {
        this.sortNo = sortNo;
    }

    /**
     * 获取是否可编辑
     *
     * @return editable_ - 是否可编辑
     */
    public Integer getEditable() {
        return editable;
    }

    /**
     * 设置是否可编辑
     *
     * @param editable 是否可编辑
     */
    public void setEditable(Integer editable) {
        this.editable = editable;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Dict other = (Dict) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getIndexId() == null ? other.getIndexId() == null : this.getIndexId().equals(other.getIndexId()))
            && (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
            && (this.getCodeText() == null ? other.getCodeText() == null : this.getCodeText().equals(other.getCodeText()))
            && (this.getSortNo() == null ? other.getSortNo() == null : this.getSortNo().equals(other.getSortNo()))
            && (this.getEditable() == null ? other.getEditable() == null : this.getEditable().equals(other.getEditable()))
            && (this.getEnable() == null ? other.getEnable() == null : this.getEnable().equals(other.getEnable()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getIndexId() == null) ? 0 : getIndexId().hashCode());
        result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
        result = prime * result + ((getCodeText() == null) ? 0 : getCodeText().hashCode());
        result = prime * result + ((getSortNo() == null) ? 0 : getSortNo().hashCode());
        result = prime * result + ((getEditable() == null) ? 0 : getEditable().hashCode());
        result = prime * result + ((getEnable() == null) ? 0 : getEnable().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", indexId=").append(indexId);
        sb.append(", code=").append(code);
        sb.append(", codeText=").append(codeText);
        sb.append(", sortNo=").append(sortNo);
        sb.append(", editable=").append(editable);

        sb.append("]");
        return sb.toString();
    }
}